
<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="tld" uri="/WEB-INF/tld/rei.tld" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@include file="/WEB-INF/include/admin-head.jsp" %>
<body>
<div class="ok-body">
	<!--form表单-->
	<form class="layui-form layui-form-pane ok-form">
	
		
		              
                    <input name="id" value="${model.id}" type="hidden" />
                
                           
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">账号</label>
			        <div class="layui-input-block">
				        <input type="text" name="username"  placeholder="请输入账号" autocomplete="off" class="layui-input" value="${model.username}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">密码</label>
			        <div class="layui-input-block">
				        <input type="text" name="password"  placeholder="请输入密码" autocomplete="off" class="layui-input" value="${model.password}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">姓名</label>
			        <div class="layui-input-block">
				        <input type="text" name="name"  placeholder="请输入姓名" autocomplete="off" class="layui-input" value="${model.name}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">电话号</label>
			        <div class="layui-input-block">
				        <input type="text" name="phone"  placeholder="请输入电话号" autocomplete="off" class="layui-input" value="${model.phone}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">照片</label>
			        <div class="layui-input-block">
				        <input type="text" name="photo"  placeholder="请输入照片" autocomplete="off" class="layui-input" value="${model.photo}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">性别</label>
			        <div class="layui-input-block">
				        <input type="text" name="sex"  placeholder="请输入性别" autocomplete="off" class="layui-input" value="${model.sex}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">身份证号</label>
			        <div class="layui-input-block">
				        <input type="text" name="idcard"  placeholder="请输入身份证号" autocomplete="off" class="layui-input" value="${model.idcard}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">年龄</label>
			        <div class="layui-input-block">
				        <input type="text" name="age"  placeholder="请输入年龄" autocomplete="off" class="layui-input" value="${model.age}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
              
              	<div class="layui-form-item">
			        <label class="layui-form-label">身份 0用户 1客服 2管理员</label>
			        <div class="layui-input-block">
				        <input type="text" name="type"  placeholder="请输入身份 0用户 1客服 2管理员" autocomplete="off" class="layui-input" value="${model.type}" lay-verify="required">
			        </div>
		        </div>
		        
            
          
             
                     <div class="layui-form-item">
        			<label class="layui-form-label">出生日期</label>
        			<div class="layui-input-block">
        				<input type="text" name="birth" placeholder="请选择日期 格式为yyyy-MM-dd HH:mm:ss" autocomplete="off"   value="<fmt:formatDate value="${model.birth}" pattern="yyyy-MM-dd HH:mm:ss" />"
        				       class="layui-input" id="time10" lay-verify="time">
        			</div>
	        	</div>
            
          
	
	

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" type="button" lay-submit lay-filter="add">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</div>
<!--js逻辑-->
<script src="/static/lib/layui/layui.js"></script><script src="/static/js/jquery.min.js"></script>
<script>
	layui.use(["element", "form", "laydate", "okLayer", "okUtils"], function () {
		let form = layui.form;
		let laydate = layui.laydate;
		let okLayer = layui.okLayer;
		let okUtils = layui.okUtils;
		okLoading.close();
    
        laydate.render({elem: "time10", type: "datetime"});
            
		

		form.verify({
			time: [/^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))(\s(([01]\d{1})|(2[0123])):([0-5]\d):([0-5]\d))?$/, '日期格式不正确']
		});

		form.on("submit(add)", function (data) {
			$.post("/admin/user/save",data.field,function (result) {
				if (result.code == 0) {
					layer.alert("成功", {icon: 6}, function () {
						// 获得frame索引
						var index = parent.layer.getFrameIndex(window.name);
						//关闭当前frame
						parent.layer.close(index);
						window.parent.location.reload();//刷新父页面
					});
				} else {
					layer.alert("失败", {icon: 5});
				}
			})
		});
	});
</script>
</body>
</html>


